package sctu.edu.java.year2016.team01.chenhong.day20160524.chapter7_2;

/**
 * Created by Administrator on 2016/5/24.
 * 尝试编写一个矩形类，将长与宽座位矩形类的属性，在构造方法中将长、宽初始化，定义一个成员方法求此矩形的面积
 */

import java.util.Scanner;

public class Area {
    public double l;//长
    public double w;//宽



    public Area(double l, double w) {
        this.l = l;
        this.w = w;


    }

    public void E() {//打印面积

        System.out.println("矩形的面积为:" + l * w);
    }




    public static void main(String[] args) {
        System.out.println("请输入矩形的长和宽：");
        Scanner scan = new Scanner(System.in);

        int l = scan.nextInt();
        int w = scan.nextInt();


        Area D = new Area(l, w);
        D.E();


    }
}

